﻿using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Media.Animation;

namespace ABCat.UI.WPF.UI.Primitives
{
	/// <summary>
	/// Interaction logic for MetroProgressStrip.xaml
	/// </summary>
	public partial class MetroProgressStripe
	{
		public MetroProgressStripe()
		{
			InitializeComponent();

			this.IsVisibleChanged += MetroProgressStripe_IsVisibleChanged;
		}

		void MetroProgressStripe_IsVisibleChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e)
		{
			if (!DesignerProperties.GetIsInDesignMode(this))
			{
				switch (Visibility)
				{
					case Visibility.Visible:
						((Storyboard)progressBar.Resources["AnimationStoryBoard"]).Begin();
						break;
					case Visibility.Hidden:
					case Visibility.Collapsed:
						((Storyboard)progressBar.Resources["AnimationStoryBoard"]).Stop();
						break;
				}
			}
		}

	}
}
